
# pip install pymupdf
import fitz
import sys

doc = fitz.open('content.pdf')

str_ = 'ygcsb'

for pg in range(doc.pageCount):
    page = doc[pg]
    zoom = 2.0 # 越大，生成图像像素越高
    rotate = int(0)
    trans = fitz.Matrix(zoom, zoom).preRotate(rotate)

    # create raster image of page (non-transparent)
    pm = page.getPixmap(matrix=trans, alpha=False)

    # write a PNG image of the page
    pm.writePNG('{}_{}.png'.format(str_,pg))